package com.example.nacos.provider.controller;

import com.example.nacos.provider.model.Product;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName : OrderController
 * @Description : 订单测试类
 * @Author : tianshuo
 * @Date: 2021-03-23 10:37
 */
@RestController
public class ProductController {

    private static final Logger logger = LoggerFactory.getLogger(ProductController.class);


    @RequestMapping("/product/{id}")
    public Product product(@PathVariable("id") Integer id) {
        logger.info("invoke product : {}", id);
        return new Product(id, "CP0001", "交通局");
    }

    @GetMapping("/product/header")
    public String header(@RequestHeader("X-Request-Id") String header) {
        logger.info("gateWay获取请求头X-Request-color：{}",header);
        return header;
    }

}

